/* The file is saved in UTF-8 codepage.
 * Check: «Stereotype», Section mark-§, Copyright-©, Alpha-α, Beta-β, Smile-☺
 */
package cz.pecinovsky.english.lootp._115_;

import cz.pecinovsky.english.lootp._parents._IArrow_116_119;
import cz.pecinovsky.english.lootp.manager.IPaintable;
import cz.pecinovsky.english.lootp.manager.Painter;
import cz.pecinovsky.english.lootp.manager.Rectangle;
import cz.pecinovsky.english.lootp.manager.Triangle;

import cz.pecinovsky.english.lootp.utility.NamedColor;
import cz.pecinovsky.english.lootp.utility.Direction8;

// %I+ <119
//import cz.pecinovsky.english.lootp.shapes.Rectangle;
//import cz.pecinovsky.english.lootp.shapes.Triangle;
// %I-



//import cz.pecinovsky.english.lootp._115_.Arrow_116_119.Arrow;
////////////////////////////////////////////////////////////////////////////////
//%%+  +++++ End of ignored starting test - place for imports +++++

//%X+ xxxxx Start of the ovejumped text with declaration of the envelope xxxxx
/*******************************************************************************
 *<pre>
 * Previous:  No - this is a newly defined class
 * Following: {@link cz.pecinovsky.english.lootp._115_.Arrow_120_124}
 *
 * Project  016z - First constructor
 *   + Two constructors
 *
 * Project  017z - Parameters
 *   + Constructors with parameters
 *
 * Project  018z - Attributes and methods
 *   + Attributes body, head, color
 *   ~ Constructors save the values into the attributes
 *   + Methods setColor(NamedColor), translucent() a restoreColor()
 *
 * Project  019z_11_Manager
 *   ~ Class transformed into project controlled by a canvas manager
 *   + Implements the interface {@link IPaintable}
 *     + The method {@code paint(Painter)} required by the interface added
 *
 *</pre>
 *
 * @author Rudolf PECINOVSKÝ
 * @version 6.03.2017 — 2010-11-08
 */
public class Arrow_116_119
{    private Arrow_116_119() {}   static
////////////////////////////////////////////////////////////////////////////////
//%X- ----- End of the ovejumped text with declaration of the envelope -----


//%I+ <119
//public class Arrow
//%I-
//%A+ >119
public class Arrow implements IPaintable
//%A-
//%A+ <0
        ,   _IArrow_116_119
//%A-
{
//%A+ >118
    private Rectangle  body;
    private Triangle   head;
    private NamedColor color;


//%A-
    public Arrow()
    {
//%I+ <118
//        new Rectangle( 0, 15, 25, 20, NamedColor.BLACK);
//        new Triangle (25,  0, 25, 50, NamedColor.BLACK, Direction8.EAST);
//%I-
//%A+ >118
        color = NamedColor.BLACK;
        body  = new Rectangle( 0, 15, 25, 20, color);
        head  = new Triangle (25,  0, 25, 50, color, Direction8.EAST);
//%A-
    }
//%A+ >117


    public Arrow(int x, int y)
    {
//%A-
//%I+ =117z
//        new Rectangle(x,    y+15, 25, 20, NamedColor.BLACK);
//        new Triangle (x+25, y,    25, 50, NamedColor.BLACK, Direction8.EAST);
//%I-
//%A+ >118
        color = NamedColor.BLACK;
        body  = new Rectangle(x,    y+15, 25, 20, color);
        head  = new Triangle (x+25, y,    25, 50, color, Direction8.EAST);
//%A-
//%A+ >117
    }


//%A-
//%I+ =117z
//    public Arrow(int x, int y, NamedColor color)
//    {
//        new Rectangle(x,    y+15, 25, 20, color);
//        new Triangle (x+25, y,    25, 50, color, Direction8.EAST);
//    }
//%I-
//%A+ >118
    public Arrow(int x, int y, NamedColor c)
    {
        color = c;
        body  = new Rectangle(x,    y+15, 25, 20, c);
        head  = new Triangle (x+25, y,    25, 50, c, Direction8.EAST);
    }


//%A-
//%A+ <0
        @Override
//%A-
//%A+ >118
    public void setColor(NamedColor color)
    {
        body.setColor(color);
        head.setColor(color);
    }


//%A-
//%A+ <0
        @Override
//%A-
//%A+ >118
    public void translucent()
    {
        body.setColor(color.translucent());
        head.setColor(color.translucent());
    }


//%A-
//%A+ <0
        @Override
//%A-
//%A+ >118
    public void restoreColor()
    {
        setColor(color);
    }
//%A-
//%A+ >119


    /***************************************************************************
     * Paint the instance by force the specified painter.
     *
     * @param painter Painter drawing the instance
     */
    @Override
    public void paint(Painter painter)
    {
        body.paint(painter);
        head.paint(painter);
    }
//%A-
    }

//%%- ---- Start of the ovejumped text with closing of the envelope ----
////////////////////////////////////////////////////////////////////////////////
//== TESTING CLASSES AND METHODS ===============================================
//
//    /***************************************************************************
//     * Test method.
//     */
//    public static void test()
//    {
//        new Arrow();
//        new Arrow(50, 50);
//    }
//    /** @param args Command line arguments - they are not used. */
//    public static void main(String[] args)  {  test();  }
}
